/****************************************************************************
 * 2025.5 LAPTOP-OMJU83NA
 ****************************************************************************/

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using TMPro;

namespace Survivor
{
	public partial class LogPanel : UIElement
	{
		private void Awake()
		{
			ButtonLogClose.onClick.AddListener(this.Hide);
			ButtonLogNext.onClick.AddListener(() =>
			{
				int pageNum = TextDDALog.textInfo.pageCount;
				if (pageNum == TextDDALog.pageToDisplay) return;
				TextDDALog.pageToDisplay += 1;
			});
			ButtonLogLast.onClick.AddListener(() =>
			{
				if (TextDDALog.pageToDisplay == 1) return;
				TextDDALog.pageToDisplay -= 1;
			});
			Global.DDALog.RegisterWithInitValue((value) =>
				{
					TextDDALog.text = value;
				}
			);
		}

		protected override void OnShow()
		{
			base.OnShow();
		}

		protected override void OnBeforeDestroy()
		{
		}
	}
}